home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #1 / Ham Radio 2000.iso / ham2000 / hf / dsp / dsp4src / spy.asm < prev    next >
Encoding:
Assembly Source File  |  1994-03-26  |  2.0 KB  |  114 lines

  1. ;***************************************************************
  2. ;* SPY.ASM -- Simple oscilloscope with SPY               *
  3. ;*                                   *
  4. ;* Displays Left channel on the SPY program.               *
  5. ;*                                   *
  6. ;* Copyright (C) 1994 by Alef Null. All rights reserved.       *
  7. ;* Author(s): Jarkko Vuori, OH2LNS                   *
  8. ;* Modification(s):                           *
  9. ;***************************************************************
  10.  
  11.  
  12.     nolist
  13.     include 'leonid'
  14.     list
  15.  
  16.  
  17. buflen    equ    16                    ; lenght of sample buffer
  18.  
  19. ; flags
  20. spyflg    equ    3                    ; spy on/off
  21.  
  22.  
  23.     org    p:user_code
  24.  
  25.     move            #buffer+2,r7
  26.     move            #buflen*4-1,m7
  27.  
  28.     move            #buffer,r2
  29.     move            #4-1,n2
  30.     move            #buflen*4-1,m2
  31.  
  32.     ctrlcd    1,r2,buflen,LINEI,0.0,0.0,LINEO|HEADP,0.0,0.0
  33.     opencd    8
  34.  
  35. ; wait for one complete block
  36. loop    waitblk r2,buflen,1
  37.  
  38. ; copy left channel to the both outputs
  39.     move            x:(r2)+,a
  40.     move            a,y:(r2)+
  41.     move            a,y:(r2)+
  42.     move            (r2)+
  43.  
  44. ; and to the spy
  45.     jsr    <spy
  46.  
  47.     jmp    <loop
  48.  
  49.  
  50. ; *** special spy ***
  51. spy    jset    #spyflg,x:<flag,_spyon
  52.  
  53.     lookc                        ; check if spy operation requested
  54.     jcs    <_spyend
  55.     move            #>'S',a
  56.     cmp    x0,a
  57.     jne    <_spyend
  58.  
  59.     move            #>'P',x0            ; yes, send first a preamble
  60.     putc
  61.     move            #>512,a1
  62.     move            a1,x:<spyn
  63.     move            #>1,a1
  64.     move            a1,x:<spym
  65.     bset    #spyflg,x:<flag
  66.     jmp    <_spyend
  67.  
  68. ; spy is active, send a register to the host
  69. _spyon    move            x:<spym,b
  70.     move            #>1,y1
  71.     sub    y1,b        #>1,y1
  72.     move            b,x:<spym
  73.     jne    <_spyend
  74.     move            y1,x:<spym
  75.  
  76.     move            a,y0            ; LSB first
  77.     rep    #8
  78.     lsr    a
  79.     move    a1,x0
  80.     putc
  81.  
  82.     move            y0,a            ; then HSB
  83.     rep    #16
  84.     lsr    a
  85.     move    a1,x0
  86.     putc
  87.  
  88.     move            x:<spyn,a            ; check if all samples allready given
  89.     move            #>1,x0
  90.     sub    x0,a
  91.     move            a,x:<spyn
  92.     jne    <_spyend
  93.     bclr    #spyflg,x:<flag
  94.  
  95. _spyend rts
  96.  
  97.  
  98.  
  99.     org    x:user_data
  100.  
  101. flag    dc    0
  102. spyn    ds    1
  103. spym    ds    1
  104.  
  105. buffer    dsm    buflen*4
  106.  
  107.  
  108.     org    y:user_data
  109.  
  110.     dsm    buflen*4
  111.  
  112.  
  113.     end
  114.